#include <stdio.h>

int main()
{
    int n;
    int sum=0;
    int num;
    int i;
	while(scanf("%d",&n)==1)
	{
		if(n==0)
		break;
		sum=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&num);
			sum+=num;
		}
		printf("%d\n",sum);
	}
    return 0;
}
